using Lifter.Global.Device;
using System;
using System.ComponentModel;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Windows.Forms;
namespace Lifter.Gui.Monitor.Controls
{
	public class ElevUI : BaseControl
	{
		private ElevType elevatorType = ElevType.NORMAL;
		private int borderWith = 2;
		private IContainer components = null;
		public ElevType ElevatorType
		{
			get
			{
				return this.elevatorType;
			}
			set
			{
				this.elevatorType = value;
				base.Invalidate();
			}
		}
		public int BorderWith
		{
			get
			{
				return this.borderWith;
			}
			set
			{
				this.borderWith = value;
				base.Invalidate();
			}
		}
		public ElevUI()
		{
			this.InitializeComponent();
		}
		public ElevUI(IContainer container)
		{
			container.Add(this);
			this.InitializeComponent();
		}
		protected override void OnPaint(PaintEventArgs e)
		{
			this.DrawBody(e.Graphics);
		}
		private void DrawBody(Graphics g)
		{
			if (g == null)
			{
				g = base.CreateGraphics();
			}
			g.SmoothingMode = SmoothingMode.HighQuality;
			Brush aliceBlue = Brushes.AliceBlue;
			Brush black = Brushes.Black;
			Rectangle rect = new Rectangle(this.borderWith, this.borderWith, base.Width - this.borderWith * 2, base.Height - this.borderWith * 2);
			Font font = new Font("Arial", 8f, FontStyle.Bold);
			StringFormat stringFormat = new StringFormat();
			stringFormat.Alignment = StringAlignment.Center;
			stringFormat.LineAlignment = StringAlignment.Center;
			base.DrawRoundRect(g, rect, 4, aliceBlue, black, this.borderWith);
			g.DrawString(ElevType.ValueToString(this.elevatorType), font, Brushes.Blue, new RectangleF(0f, 0f, (float)base.Width, (float)base.Height), stringFormat);
		}
		protected override void Dispose(bool disposing)
		{
			if (disposing && this.components != null)
			{
				this.components.Dispose();
			}
			base.Dispose(disposing);
		}
		private void InitializeComponent()
		{
			this.components = new Container();
		}
	}
}
